
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8" />
    <title>{$Think.get.title}--{$tpshop_config['shop_info_store_title']}</title>
    <!-- <link rel="stylesheet" href="__STATIC__/css/style.css"> -->
    <link rel="stylesheet" type="text/css" href="__STATIC__/css/iconfont.css"/>
    <link rel="stylesheet" type="text/css" href="__STATIC__/css/reset.css"/>
    <link rel="stylesheet" type="text/css" href="__STATIC__/css/mesg_center.css"/>
    <script src="__STATIC__/js/jquery-3.1.1.min.js" type="text/javascript" charset="utf-8"></script>
    <!--<script src="__STATIC__/js/zepto-1.2.0-min.js" type="text/javascript" charset="utf-8"></script>-->
    <script src="__STATIC__/js/style.js" type="text/javascript" charset="utf-8"></script>
    <script src="__STATIC__/js/mobile-util.js" type="text/javascript" charset="utf-8"></script>
    <script src="__PUBLIC__/js/global.js"></script>
    <script src="__STATIC__/js/layer.js"  type="text/javascript" ></script>
    <script src="__STATIC__/js/swipeSlide.min.js" type="text/javascript" charset="utf-8"></script>
    <link rel="shortcut icon" type="image/x-icon" href="{$tpshop_config.shop_info_store_ico|default='/public/static/images/logo/storeico_default.png'}" media="screen"/>
</head>
<body class="">
<style type="text/css">
    body{
        background-color:#efefef;
    }
</style>
<div class="header mesg_tit">
	<a href="javascript:history.back(-1);"><img src="__STATIC__/images/return.png"></a>
    <span>{$Think.get.title}</span>
    <button value="清空" class="clear_mesgbtn">清空</button>
</div>
<div class="logistics_mesg" id="ajax_return">
    <volist name="lists" id="v">
        <if condition="($Think.get.type == 0)"/>
        <div class="logistics_items" txt="通知">
            <h4>{$v.send_time_text}</h4>
            <div class="mesg_cont mesgcont_spec">
                <p>{$v.message_notice.message_title}<empty name="v.is_see"><i></i></empty></p>
            <span>
                <em><b>{$v.message_notice.message_content}</b></em>
            </span>

                <if condition="$v.message_notice.type eq '2'"/>
                <div class="mesgdeta_thi notice_mesgde_thi"><a href="javascript:messageNoticeInfo2('{:U('Mobile/User/coupon')}',{$v.rec_id});">立即使用</a></div>
                <elseif condition="($v.message_notice.type eq '3')"/>
                <div class="mesgdeta_thi notice_mesgde_thi"><a href="javascript:messageNoticeInfo2('{:U('Mobile/User/coupon',['type'=>1])}',{$v.rec_id});">查看详情</a></div>
                <elseif condition="($v.message_notice.type eq '4')"/>
                <div class="mesgdeta_thi notice_mesgde_thi"><a href="javascript:messageNoticeInfo2('{:U('Mobile/User/coupon')}',{$v.rec_id});">查看详情</a></div>
                <elseif condition="($v.message_notice.type eq '6')"/>
                <div class="mesgdeta_thi notice_mesgde_thi"><a href="javascript:messageNoticeInfo2('{:U('Mobile/User/withdrawals_list')}',{$v.rec_id});">查看详情</a></div>
                <elseif condition="$v.message_notice.mmt_code eq 'message_notice'"/>
                <div class="mesgdeta_thi notice_mesgde_thi"><a href="javascript:messageNoticeInfo({$v.rec_id});">查看详情</a></div>
                <else/>
                <div class="mesgdeta_thi notice_mesgde_thi"><a href="javascript:messageNoticeInfo({$v.rec_id});">查看详情</a></div>
                </if>


            </div>
        </div>

        <elseif condition="$Think.get.type == 1"/>
        <div class="logistics_items" txt="活动">
            <h4>{$v.send_time_text}</h4>
            <div class="mesg_cont mesgcont_active">
                <p>{$v.message_activity.message_title}<empty name="v.is_see"><i></i></empty></p>
            <span>
                <em>
                    <img src="{$v.message_activity.img_uri}">
                    <if condition="($v.finished)"><i>活动已结束</i></if>
                </em>
                <b>{$v.message_activity.message_content|htmlspecialchars_decode}</b>
            </span>
                <a href="javascript:messageAcitivityInfo('{$v.mobile_url}',{$v.rec_id},'{$v.message_activity.mmt_code}','{$v.finished}','{$v.start_time}');">查看详情</a>
            </div>
        </div>

        <elseif condition="$Think.get.type == 2"/>
        <div class="logistics_items" txt="物流">
            <h4>{$v.send_time_text}</h4>
            <div class="mesg_cont">
                <p>{$v.message_logistics.message_title}<empty name="v.is_see"><i></i></empty></p>
            <span>
                <em><b>{$v.message_logistics.message_content}</b><i>{$v.order_text}</i></em>
                <img src="{$v.message_logistics.img_uri}">
            </span>
                <a href="javascript:messageLogisticsInfo('{$v.mobile_url}','{$v.message_logistics.order_id}','{$v.message_logistics.order_sn}',{$v.rec_id});;">查看详情</a>
            </div>
        </div>

        </if>
    </volist>
</div>

<div class="mesg_bounce">
	<div class="mesg_clear">
    	<b>确定清空全部消息？</b>
        <span>
        	<input type="button" value="取消" class="mesg_cancel">
            <input type="button" value="确定" class="mesg_ensure">
        </span>
    </div>
</div>

<script type="text/javascript" src="__STATIC__/js/sourch_submit.js"></script>
<script type="text/javascript">
    var  page = 1;
    var flag = true;
    /**
     *加载更多
     */
    function ajax_sourch_submit()
    {
        if (!flag) return;
        flag = false;
        page += 1;
        $.ajax({
            type : "GET",
            url:"/index.php?m=Mobile&c=User&a=message_notice_detail&type={$Request.param.type}&is_ajax=1&p="+page,//+tab,
            success: function(data)
            {
                if(data ) {

                    flag = true;
                    $("#ajax_return").append(data);
                    // $(".m_loading").hide();
                } else {
                    flag = false;
                }
            }
        });
    }
</script>

<script>
$(".mesg_bounce").hide();
$(".clear_mesgbtn").click(function(){
	$(".mesg_bounce").show();
	});
$(".mesg_cancel").click(function(){
	$(".mesg_bounce").hide();
	});
// 清空
$(".mesg_ensure").click(function(){
	$(".mesg_bounce").hide();
	$(".logistics_mesg").empty();
    deletedMessage('')
	});


// 删除消息
function deletedMessage(msg_id) {

    $.ajax({
        type: "POST",
        url: "{:U('Home/User/deletedMessage')}",
        data: {msg_id: msg_id,type:"{$Think.get.type}"},
        dataType: 'json',
        success: function (data) {

        },
        error: function () {
            showErrorMsg('网络错误，请稍后再试');
        }
    });
  
}
// 查看通知消息详情
function messageNoticeInfo(msg_id, is_see) {
    location.href = "{:U('Mobile/User/message_notice_info')}" + "?msg_id=" + msg_id + "&type=0"
}

function messageNoticeInfo2(url, msg_id) {
    setMessageForRead(msg_id);      
    location.href = url
}
// 查看活动消息详情
function messageAcitivityInfo(url, msg_id, mmt_code, is_finished,is_start) {
    setMessageForRead(msg_id);  
    if (is_finished) {
        showErrorMsg('活动已结束！');
        return;    
    }
    if (is_start) {
        showErrorMsg('活动开始时间:'+is_start);
        return;
    }
    if (mmt_code == 'prom_order_activity') {
        //showErrorMsg('订单促销需要您下单');
        location.href = "{:U('Mobile/User/message_notice_info')}" + "?msg_id=" + msg_id + "&type=1"
        return;
    } 
    location.href = url;
}

function messageLogisticsInfo(url, order_id, order_sn, msg_id){

    setMessageForRead(msg_id);    
    location.href = url;
    
}

function setMessageForRead(msg_id) {
    $.ajax({
        type: "POST",
        url: "{:U('Home/User/setMessageForRead')}",
        data: {msg_id: msg_id},
        dataType: 'json',
        success: function (data) {
        },
        error: function () {
        }
    });
}
</script>
</body>
</html>
